<h3>Listing cancellation reports</h3>

<table>
  <tr>
    <th>Date</th>
    <th>Start time</th>
    <th>End time</th>
    <% if @current_user.student? %>
      <th>Instructor</th>
    <% else %>
      <th>Student</th>
    <% end %>
    <th>Reason</th>
    <th></th>
    <th></th>
    <th></th>
  </tr>

<% @cancellation_reports.each do |cancellation_report| %>
  <tr>
		<td><%= cancellation_report.date %></td>
    <td><%= cancellation_report.start_time %></td>
    <td><%= cancellation_report.end_time %></td>
    <% if @current_user.student? %>
      <td><%= link_to cancellation_report.instructor.full_name, cancellation_report.instructor %></td>
    <% else %>
      <td><%= link_to cancellation_report.student.full_name, cancellation_report.student %></td>
    <% end %>
    <td><%= cancellation_report.display_reason %></td>
    <td><%= link_to 'Show', timeslot_cancellation_report_path(cancellation_report.timeslot) %></td>
    <% unless @current_user.student? %>
      <td><%= link_to 'Edit', edit_timeslot_cancellation_report_path(cancellation_report.timeslot) %></td>
      <td><%= link_to 'Destroy', timeslot_cancellation_report_path(cancellation_report.timeslot), confirm: 'Are you sure?', method: :delete %></td>
    <% end %>
  </tr>
<% end %>
</table>

<br />
